package main

import (
	"fmt"
	"gvb_server/core"
	"gvb_server/flag"
	"gvb_server/global"
	"gvb_server/routers"
	"log"
)

func main() {
	log.Println("开始初始化conf")
	core.InitConf()
	global.Log = core.InitLogger()
	global.Log.Info("开始初始化数据库")
	global.DB = core.InitGorm()
	fmt.Println(global.DB)
	option := flag.Parse()
	if flag.IsStopWeb(option) {
		flag.SwitchOption(option)
		return
	}
	router := routers.InitRouter()
	addr := global.Config.System.Addr()
	global.Log.Info("gvb_server运行在:", addr)
	router.Run(addr)
}
